package com.gxa.xly2024.controller;

import com.gxa.xly2024.pojo.Purchase;
import com.gxa.xly2024.service.impl.PurchaseServiceImpl;
import com.gxa.xly2024.vo.VO;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("/purchase")
public class PurchaseController {

    @Resource
    private PurchaseServiceImpl purchaseService;

    @GetMapping("/selectPurchaseById")
    public Map<String, Object> selectPurchase(Integer id) {
        return this.purchaseService.selectPurchaseById(id);
    }

    @GetMapping("/selectPurchaseByLimit")
    public Map<String, Object> selectPurchaseByLimit(VO vo) {
        return this.purchaseService.selectPurchaseByLimit(vo);
    }

    @PostMapping("/insert_Purchase")
    public Map<String, Object> insert(@RequestBody Purchase purchase) {   // 接收前端传递的json对象
        return this.purchaseService.insert(purchase);
    }

    @PostMapping("/updateById_Purchase")
    public Map<String, Object> updateById(@RequestBody Purchase purchase) {   // 接收前端传递的json对象
        return this.purchaseService.updateById(purchase);
    }
    @PostMapping("/deleteById_Purchase")
    public Map<String, Object> deleteById(Integer id) {   // 接收前端传递的json对象
        return this.purchaseService.deleteById(id);
    }
}
